library(tidyverse) # CRAN v1.3.0
library(progress) # CRAN v1.2.2
library(ggrepel)
library(lubridate)
Attaching package: ‘lubridate’
The following objects are masked from ‘package:base’:
date, intersect, setdiff, union
library(conflicted) # CRAN v1.0.4
conflict_prefer("filter", "dplyr")
[conflicted] Will prefer dplyr::filter over any other package
source("functions.R")
source("cleaning.R")
source("estimation.R")
source("graphs.R")
source("display.R")
options(dplyr.summarise.inform = FALSE)
games <- read_rds("~/Documents/r-projects/scoresway/rds/games.rds")
with_pre <- read_rds("wpre.rds")
with_pre
k <- 20
options(dplyr.summarise.inform = FALSE)
pb <- progress_bar$new(format = " progress [:bar] :percent eta: :eta", total = nrow(with_pre), width = 40)
with_pre %>%
mutate(rat=map2(this, pre, ~this_ratings(.x, .y, k, games))) %>%
mutate(post=map(rat, "r")) %>%
mutate(updates=map(rat, "d")) -> with_post
progress [--------------] 3% eta: 12s
progress [>-------------] 4% eta: 11s
progress [>-------------] 5% eta: 10s
progress [>-------------] 6% eta: 9s
progress [>-------------] 8% eta: 9s
progress [>-------------] 9% eta: 9s
progress [>-------------] 10% eta: 8s
progress [=>------------] 11% eta: 8s
progress [=>------------] 13% eta: 8s
progress [=>------------] 14% eta: 8s
progress [=>------------] 15% eta: 8s
progress [=>------------] 16% eta: 7s
progress [=>------------] 18% eta: 7s
progress [==>-----------] 19% eta: 7s
progress [==>-----------] 20% eta: 7s
progress [==>-----------] 22% eta: 7s
progress [==>-----------] 23% eta: 7s
progress [==>-----------] 24% eta: 7s
progress [===>----------] 25% eta: 6s
progress [===>----------] 27% eta: 6s
progress [===>----------] 28% eta: 7s
progress [===>----------] 29% eta: 6s
progress [===>----------] 30% eta: 6s
progress [===>----------] 32% eta: 6s
progress [====>---------] 33% eta: 6s
progress [====>---------] 34% eta: 6s
progress [====>---------] 35% eta: 6s
progress [====>---------] 37% eta: 6s
progress [====>---------] 38% eta: 6s
progress [====>---------] 39% eta: 5s
progress [=====>--------] 41% eta: 5s
progress [=====>--------] 42% eta: 5s
progress [=====>--------] 43% eta: 5s
progress [=====>--------] 44% eta: 5s
progress [=====>--------] 46% eta: 5s
progress [======>-------] 47% eta: 5s
progress [======>-------] 48% eta: 5s
progress [======>-------] 49% eta: 4s
progress [======>-------] 51% eta: 4s
progress [======>-------] 52% eta: 4s
progress [======>-------] 53% eta: 4s
progress [=======>------] 54% eta: 4s
progress [=======>------] 56% eta: 4s
progress [=======>------] 57% eta: 4s
progress [=======>------] 58% eta: 4s
progress [=======>------] 59% eta: 4s
progress [========>-----] 61% eta: 3s
progress [========>-----] 62% eta: 3s
progress [========>-----] 63% eta: 3s
progress [========>-----] 65% eta: 3s
progress [========>-----] 66% eta: 3s
progress [========>-----] 67% eta: 3s
progress [=========>----] 68% eta: 3s
progress [=========>----] 70% eta: 3s
progress [=========>----] 71% eta: 3s
progress [=========>----] 72% eta: 2s
progress [=========>----] 73% eta: 2s
progress [=========>----] 75% eta: 2s
progress [==========>---] 76% eta: 2s
progress [==========>---] 77% eta: 2s
progress [==========>---] 78% eta: 2s
progress [==========>---] 80% eta: 2s
progress [==========>---] 81% eta: 2s
progress [===========>--] 82% eta: 2s
progress [===========>--] 84% eta: 1s
progress [===========>--] 85% eta: 1s
progress [===========>--] 86% eta: 1s
progress [===========>--] 87% eta: 1s
progress [===========>--] 89% eta: 1s
progress [============>-] 90% eta: 1s
progress [============>-] 91% eta: 1s
progress [============>-] 92% eta: 1s
progress [============>-] 94% eta: 1s
progress [============>-] 95% eta: 0s
progress [============>-] 96% eta: 0s
progress [=============>] 97% eta: 0s
progress [=============>] 99% eta: 0s
progress [==============] 100% eta: 0s
with_post
save
write_rds(with_post, "wpost.rds")
read
with_post <- read_rds("wpost.rds")
see post values sorted in tabs
since_hrs <- 24
with_post %>%
mutate(latest=map_dbl(updates, ~max(.$time_stamp))) %>%
mutate(since=(now()-as_datetime(latest))/dhours(1)) %>%
filter(since<=since_hrs) -> wp2
wp2
not quite right yet
disp("iceland")
Error in View : argument "league_name" is missing, with no default
see post values sorted in tabs
# read_csv("wanted.txt") %>% pull(want) -> wants
# wants
# with_post <- read_rds("wpost.rds")
# with_post %>% filter(league %in% wants) %>% # edit/remove slice
wp2 %>%
arrange(desc(league)) %>%
select(post, updates, league) %>%
pwalk(~display(..1, ..2, ..3)) # first input to pwalk can be a df
# time_graph("england 2", with_post)
map(wp2$league, ~time_graph(., with_post))
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
Joining, by = "team"
[[1]]
[[2]]
[[3]]
[[4]]
[[5]]
[[6]]
[[7]]
[[8]]
[[9]]
[[10]]
[[11]]
[[12]]
[[13]]
[[14]]
[[15]]